<template>
	<view class="pjbox">
		
		<view class="pingJia" v-for="(item, i) in list" :key="i">
			<view class="goodsbox">
				<image :src="item.guige_img" mode=""></image>
				<view class="info">
					<text class="line-2">{{ item.title || '' }}</text>
					<text v-if="item.price_sale">￥{{ item.price_sale }}</text>
				</view>
			</view>
			<view class="card">
				<view class="userbox">
					<view class="user">
						<image :src="item.touxiang" mode=""></image>
						<text>{{ item.username }}</text>
					</view>
					<view class="info">
						<text>{{ item.dtTime }}</text>
					</view>
				</view>
				<view class="ggbox mt16">
					<text>{{ item.key_vals || '无规格' }}</text>
				</view>
				<view class="content">
					<text>{{ item.content }}</text>
					<view class="mt26">
						<u-album :urls="item.imgs" ></u-album>
					</view>
				</view>
			</view>
		</view>
		<u-loadmore :status="status" />
		<u-loading-page :loading="loading"></u-loading-page>
	</view>
</template>

<script>
import API from '@/common/api';
export default {
	name: 'pingJia',
	data() {
		return {
			loading:true,
			status: '',
			list: [],
			paging: {
				page: 1,
				pagenum: 10
			}
		};
	},
	onLoad() {
		this.reset();
		this.init();
	},
	onReachBottom() {
		if (this.status === 'nomore') return;
		this.init(this.current);
	},
	methods: {
		reset(){
			this.paging.page = 1;
			this.list = [];
		},
		init() {
			this.loading = true;
			this.status = 'loading';
			this.$http.getJson('users_myselfComments', {}).then((res) => {
				this.loading = false;
				const { code, message } = res;
				if (code === 1) {
					let data = res.data.list;
					if (data.length !== 0) this.list = this.list.concat(data);
					if (this.paging.pagenum === data.length) {
						this.paging.page += 1;
						this.status = 'loadmore';
					} else {
						this.status = 'nomore';
					}
				}
			});
		}
	}
};
</script>

<style lang="less" scoped>
.pjbox {
}
.pingJia {
	.ggbox {
		text {
			font-size: 24rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #9695a3;
		}
	}

	.card {
		// margin-bottom: 30rpx;
		width: 750rpx;
		padding: 40rpx 30rpx;
		background: #ffffff;
		border-radius: 32rpx;
		.userbox {
			.flex-between();
			.user {
				display: flex;
				align-items: center;
				& > image {
					width: 56rpx;
					height: 56rpx;
					border-radius: 50%;
					background: #f5f5f5;
				}
				& > text {
					margin-left: 24rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #000000;
				}
			}
			.info {
				text {
					font-size: 24rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #9695a3;
				}
			}
		}
		.content {
			margin-top: 26rpx;
			& > text {
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #000000;
			}
		}
	}

	.goodsbox {
		display: flex;
		padding: 32rpx;
		image {
			width: 142rpx;
			height: 142rpx;
			background: #e7e7e7;
		}
		.info {
			flex: 1;
			margin-left: 24rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			text:nth-of-type(1) {
				font-size: 28rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #000000;
			}
			text:nth-of-type(2) {
				font-size: 28rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #000000;
			}
		}
	}
}
</style>
